# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-rss
_gemname=rss
pkgver=0.3.0
pkgrel=0
pkgdesc="RSS reading and writing for Ruby"
url="https://github.com/ruby/rss"
arch="noarch"
license="BSD-2-Clause"
depends="ruby ruby-rexml"
checkdepends="ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/rss/archive/$pkgver/ruby-rss-$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	ruby test/run-test.rb
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins

	cd "$gemdir"/gems/$_gemname-$pkgver
	rm README.* NEWS.*
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
86b7097e3dcf0da03284b44493be43e972a1facb2f20e81cc3303ea0c39336a364858f3d37e04a2397851ca897bd484284eb81cd6d6b55f4c0d77d811350688e  ruby-rss-0.3.0.tar.gz
"
